import { ref, reactive } from 'vue'
import { EditType } from '@/type/BaseEnum'
import { auditorFilesListApi } from '@/api/ReviewBusiness/01Project/project'
export default function moreHistoryModel() {
  const RefMoreHistory = ref<{ show: (type: string, row?: any) => void }>()
  const searchDate = reactive({
    search: {},
    list: [] as any,
    Loading: false,
    height:400
  })
  const moreBtn = (row) => {
    RefMoreHistory.value?.show(EditType.EDIT, row)
  }
  const getMore = async (row) => {
    console.log(row);
    
    searchDate.Loading = true
    const params = {
      filesId: row.id
      // filesName: row.fileName,
      // auditorStageId: row.auditorStageId
    }
    const res = await auditorFilesListApi(params)
    if (res.code === 200) {
      searchDate.list = res.data&&res.data.map(item=>{
        return {
          ...item,stageId:row.stageId
        }
      })
      searchDate.Loading = false
    }
  }
  return {
    moreBtn, RefMoreHistory, getMore,searchDate
  }
}